﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SAI.nQueens
{
    class QueenNode : Node
    {
        private int row = -1;
        private int column = -1;

        public QueenNode(string id) : base(id)
        {
            _id = id;
            _outNeighbors = new List<Node>();
            _visited = false;
            _parent = null;
        }

        public int Column
        {
            get { return column; }
            set { column = value; }
        }

        public int Row
        {
            get { return row; }
            set { row = value; }
        }

        public bool IsAttacking(QueenNode q)
        {
            if (this.row == q.row || this.column == q.column) return true;
            if (Math.Abs(this.row - q.row) == Math.Abs(this.column - q.column)) return true;
            return false;
        }

        public bool isAttacking(int row, int column)
        {
            if (this.row == row || this.column == column) return true;
            if (Math.Abs(this.row - row) == Math.Abs(this.column - column)) return true;
            return false;
        }

        public override List<Node> getOutNeighbors()
        {
            return _outNeighbors;
        }

        public override void printNode() { }
    }
}
